package cn.iocoder.yudao.module.biz.dal.mysql.licenceSafeMeasuresSetting;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.biz.controller.admin.licenceSafeMeasuresSetting.vo.BizLicenceSafeMeasuresSettingExportReqVO;
import cn.iocoder.yudao.module.biz.controller.admin.licenceSafeMeasuresSetting.vo.BizLicenceSafeMeasuresSettingPageReqVO;
import cn.iocoder.yudao.module.biz.dal.dataobject.licenceSafeMeasuresSetting.BizLicenceSafeMeasuresSettingDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 危险作业票安全措施配置 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface BizLicenceSafeMeasuresSettingMapper extends BaseMapperX<BizLicenceSafeMeasuresSettingDO> {

    default PageResult<BizLicenceSafeMeasuresSettingDO> selectPage(BizLicenceSafeMeasuresSettingPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BizLicenceSafeMeasuresSettingDO>()
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getContent, reqVO.getContent())
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getType, reqVO.getType())
                .betweenIfPresent(BizLicenceSafeMeasuresSettingDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizLicenceSafeMeasuresSettingDO::getId));
    }

    default List<BizLicenceSafeMeasuresSettingDO> selectList(BizLicenceSafeMeasuresSettingExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<BizLicenceSafeMeasuresSettingDO>()
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getContent, reqVO.getContent())
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getType, reqVO.getType())
                .betweenIfPresent(BizLicenceSafeMeasuresSettingDO::getCreateTime, reqVO.getBeginCreateTime(), reqVO.getEndCreateTime())
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getDeptId, reqVO.getDeptId())
                .orderByDesc(BizLicenceSafeMeasuresSettingDO::getId));
    }

    default List<BizLicenceSafeMeasuresSettingDO> selectByType(Integer type ){
        return selectList(new LambdaQueryWrapperX<BizLicenceSafeMeasuresSettingDO>()
                .eqIfPresent(BizLicenceSafeMeasuresSettingDO::getType, type)
                .orderByDesc(BizLicenceSafeMeasuresSettingDO::getCreateTime));
    }
}
